package utils.string;

public final class StringUtils {
    /**
     * check if string is empty.</br>
     * 
     *
     * @param str
     *            string
     * @return if string is null or length of string is 0, or string consists of
     *         spaces,will return true; others will return false.
     * @author zhangbo
     * @since 1.0.0
     */
    public static boolean isEmpty(String str) {
        if (str == null) {
            return true;
        }
        if (str.length() == 0) {
            return true;
        }
        if (str.trim()
                .length() == 0) {
            return true;
        }
        return false;
    }

    /**
     * check if string is not empty.
     *
     * @param str
     *            string
     * @return result is opposite to {@link utils.string.StringUtils#isEmpty}
     * @author zhangbo
     * @since 1.0.0
     */
    public static boolean isNotEmpty(String str) {
        return !isEmpty(str);
    }
}
